extern char *xcsv_urlbase;
extern char *prefer_shortnames;
+static int waypt_out_count;
+
/*********************************************************************/
/* csv_stringclean() - remove any unwanted characters from string. */
/* returns copy of string. */
xcsv_waypt_pr(const waypoint *wpt)
{
char buff[1024];
- static int index = 0;
char *shortname = NULL;
char *description = NULL;
char * anyname = NULL;
sprintf(buff, fmp->printfc, "");
} else
if (strcmp(fmp->key, "INDEX") == 0) {
- sprintf(buff, fmp->printfc, index + atoi(fmp->val));
+ sprintf(buff, fmp->printfc, waypt_out_count + atoi(fmp->val));
} else
if (strcmp(fmp->key, "CONSTANT") == 0) {
sprintf(buff, fmp->printfc, fmp->val);
if (description && description != shortname)
xfree(description);
- index++;
+ /* increment the index counter */
+ waypt_out_count++;
}
static void
queue *elem, *tmp;
ogue_t *ogp;
+ /* reset the index counter */
+ waypt_out_count = 0;
+
/* output prologue lines, if any. */
QUEUE_FOR_EACH(&xcsv_file.prologue, elem, tmp) {
ogp = (ogue_t *) elem;
static int i_am_little_endian;
static int endianness_tested;
+static int waypt_out_count;
static void
test_endianness(void)
if (tpg_file_out == NULL) {
fatal(MYNAME ": Cannot open %s for writing\n", fname);
}
+
+ waypt_out_count = 0;
}
static void
char c;
char *shortname;
char *description;
- static int out_count = 0;
/* these unknown 4 are probably point properties (color, icon, etc..) */
unsigned char unknown4[] = { 0x78, 0x56, 0x34, 0x12 };
unsigned char unknown2[] = { 0x01, 0x80 };
/* our personal waypoint counter */
- out_count++;
+ waypt_out_count++;
/* this output format pretty much requires a description
* and a shortname
/* and finally 2 unknown bytes */
- if (out_count == waypt_count()) {
+ if (waypt_out_count == waypt_count()) {
/* last point gets 0x0000 instead of 0x0180 */
memset(tbuf, '\0', sizeof(tbuf));
fwrite(tbuf, 1, 2, tpg_file_out);